Skip to content

Update actions for channels in the channel list#6327

Open
gpunto wants to merge 11 commits intov7from
rm-archive-primary
Open

Update actions for channels in the channel list#6327
gpunto wants to merge 11 commits intov7from
rm-archive-primary

Conversation

@gpunto
Copy link
Copy Markdown
Contributor

@gpunto gpunto commented Apr 1, 2026

Goal

Clean up channel actions:

  • The swipe action should only be "mute group", so we remove fallbacks for swipe actions
  • The "more actions" sheet for groups should not display "mute group" as that's the swipe action
  • Update the mute icon on DM channels to only reflect channel mutes and differentiate between "mute channel" (primary swipe action) and "mute user"

Implementation

  • Update swipe actions to only show mute/unmute as the primary action (remove archive and pin)
  • Remove ChannelAction.requiredCapability (it was unused)
  • Disable archive channel action by default in ChannelOptionItemVisibility as we don't have an archive screen in the SDK
  • Revert showing muted icon on DM channels based on user mute: the icon now only reflects channel mutes
  • Remove "Mute Group" / "Unmute Group" from the group channel actions sheet (the swipe action already handles channel muting)
  • Swipe actions now respect ChannelOptionItemVisibility (e.g. isMuteChannelVisible)

🎨 UI Changes

None

Testing

  • Swipe a channel item and verify only "More" and "Mute"/"Unmute" actions are shown
  • Long press a group channel → sheet should not show Mute Group
  • Long press a DM channel → sheet should show Mute User, but not Mute Channel/Group
  • Mute a DM channel via swipe → verify the mute icon appears on the channel item
  • Set isMuteChannelVisible = false in ChannelOptionItemVisibility → verify the mute swipe action is hidden

Summary by CodeRabbit

  • Changes
    • Swipe actions simplified to expose only mute/unmute.
    • Archive and pin actions removed from swipe menu.
    • Group channel menus no longer show mute/unmute.
    • DM channels can show a separate “mute user” option.
    • Archive channel option hidden by default.
    • Channel muting now relies on channel-level controls rather than per-user mute state.

@gpunto gpunto changed the title Clean up channel list actions Update actions for channels in the channel list Apr 1, 2026
@gpunto gpunto changed the base branch from develop to v7 April 1, 2026 12:59
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@gpunto gpunto added the pr:improvement Improvement label Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.82 MB 0.57 MB 🔴
stream-chat-android-ui-components 10.60 MB 10.95 MB 0.36 MB 🟡
stream-chat-android-compose 12.81 MB 12.25 MB -0.56 MB 🚀

@gpunto
Copy link
Copy Markdown
Contributor Author

gpunto commented Apr 1, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Walkthrough

Removes per-user muting for 1:1 channels, limits swipe primary action to mute/unmute, deletes group-channel mute features, drops requiredCapability from ChannelAction API, and hides archive by default; related strings and tests were removed.

Changes

Cohort / File(s) Summary
Swipe actions
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/DefaultChannelSwipeActions.kt
Primary swipe action simplified to mute/unmute; archive/pin logic removed. Replaced LocalContext.current.resources.getString(...) with LocalResources.current.getString(...). Click wiring simplified (removed lambda wrapper). Helper builders/imports removed.
Channel option visibility & API
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptionItemVisibility.kt, stream-chat-android-compose/api/stream-chat-android-compose.api
Added isMuteUserVisible: Boolean (default true); changed isArchiveChannelVisible default to false. Public constructor/component/copy signatures updated to include new boolean.
Channel options UI logic
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt
Removed group mute/unmute generation and related imports; DM mute-user gating now uses isMuteUserVisible. Group actions reduced accordingly.
ViewModel mute-state
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/channels/ChannelListViewModel.kt
Dropped per-user mute handling and isOneToOne-based logic; isMuted now computed solely from channel-level mute CIDs. Removed related parameters and helper extension.
Tests
stream-chat-android-compose/src/test/kotlin/.../ChannelListViewModelTest.kt
Removed unit tests and test fixtures that validated per-user mute behavior and helper givenUserMutes(...).
String resources
stream-chat-android-compose/src/main/res/values/strings.xml
Removed string resources for pin/unpin and archive/unarchive swipe actions and group mute/unmute menu labels.
ChannelAction API changes
stream-chat-android-ui-common/src/main/kotlin/.../state/channels/actions/ChannelAction.kt, stream-chat-android-ui-common/api/stream-chat-android-ui-common.api
Removed requiredCapability property from ChannelAction interface and its overrides in concrete action classes; removed associated default-impl bridge from API surface.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibbled the old mute thread,

hopped to tidy what lay ahead.
Swipes now whisper one simple tune,
archive tucked away by the moon.
Hope the code hums — quiet and bright.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Update actions for channels in the channel list' directly summarizes the main change: refactoring channel action handling in the channel list UI by simplifying swipe actions and updating action visibility.
Description check ✅ Passed The PR description includes a clear Goal section explaining the rationale, detailed Implementation section covering all changes, Testing section with specific verification steps, and addresses the template structure—though UI Changes section states 'None' and contributor/reviewer checklists are not filled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rm-archive-primary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt (1)

101-143: ⚠️ Potential issue | 🟠 Major

Don’t let isMuteChannelVisible hide Mute User in DMs.

After removing group mute actions, this builder still wires optionVisibility.isMuteChannelVisible into buildDmMuteUserAction. That means a caller can’t hide channel mute/unmute without also hiding the DM-sheet Mute User action, which no longer matches the flag name/KDoc or the new channel-vs-user split in this PR. The same cleanup also leaves buildDefaultChannelActions.isMuted looking like a no-op parameter. Please finish the split by decoupling DM user-mute visibility from channel-mute visibility and dropping the dead argument while you’re here.

Based on learnings, PRs against major version branches such as v7 may introduce breaking public API changes without compatibility overloads.

Also applies to: 171-176

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt`
around lines 101 - 143, The DM mute action visibility is incorrectly tied to
optionVisibility.isMuteChannelVisible and the isMuted parameter is now unused;
update buildDefaultChannelActions to remove the dead isMuted parameter,
introduce/consume a DM-specific visibility flag (e.g.
optionVisibility.isMuteUserVisible) and pass that to buildDmMuteUserAction via
buildDmChannelActions (or add a new parameter to
buildDmChannelActions/buildDmMuteUserAction) so hiding channel mute no longer
hides the DM "Mute User" action; also update related KDoc and any call sites
(and the other occurrence around lines 171-176) to use the DM-specific flag
instead of isMuteChannelVisible.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/DefaultChannelSwipeActions.kt`:
- Around line 93-108: The cached ChannelAction uses remember(channel.cid,
isMuted, canMute) so its label won't update on locale change; compute the
localized labels (e.g., val muteLabel =
resources.getString(R.string.stream_compose_swipe_action_mute) and val
unmuteLabel = resources.getString(R.string.stream_compose_swipe_action_unmute))
before calling remember and include those label strings in the remember key
(remember(channel.cid, isMuted, canMute, muteLabel, unmuteLabel)) so
MuteChannel/UnmuteChannel instances are recreated with updated localized text;
keep the existing handlerState/onAction logic and return the resolved action as
before.

---

Outside diff comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt`:
- Around line 101-143: The DM mute action visibility is incorrectly tied to
optionVisibility.isMuteChannelVisible and the isMuted parameter is now unused;
update buildDefaultChannelActions to remove the dead isMuted parameter,
introduce/consume a DM-specific visibility flag (e.g.
optionVisibility.isMuteUserVisible) and pass that to buildDmMuteUserAction via
buildDmChannelActions (or add a new parameter to
buildDmChannelActions/buildDmMuteUserAction) so hiding channel mute no longer
hides the DM "Mute User" action; also update related KDoc and any call sites
(and the other occurrence around lines 171-176) to use the DM-specific flag
instead of isMuteChannelVisible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 830cae27-743b-416a-94e5-5ab90364ac70

📥 Commits

Reviewing files that changed from the base of the PR and between 9ce7d4f and 2ad18d8.

📒 Files selected for processing (8)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/DefaultChannelSwipeActions.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptionItemVisibility.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/channels/ChannelListViewModel.kt
  • stream-chat-android-compose/src/main/res/values/strings.xml
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/viewmodel/channels/ChannelListViewModelTest.kt
  • stream-chat-android-ui-common/api/stream-chat-android-ui-common.api
  • stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/state/channels/actions/ChannelAction.kt
💤 Files with no reviewable changes (4)
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/viewmodel/channels/ChannelListViewModelTest.kt
  • stream-chat-android-ui-common/src/main/kotlin/io/getstream/chat/android/ui/common/state/channels/actions/ChannelAction.kt
  • stream-chat-android-compose/src/main/res/values/strings.xml
  • stream-chat-android-ui-common/api/stream-chat-android-ui-common.api

@gpunto gpunto marked this pull request as ready for review April 1, 2026 15:44
@gpunto gpunto requested a review from a team as a code owner April 1, 2026 15:44
@gpunto gpunto force-pushed the rm-archive-primary branch 2 times, most recently from 13dd62d to 8ed2de5 Compare April 2, 2026 11:26
) : ChannelAction {
@DrawableRes
override val icon: Int = R.drawable.stream_ic_action_leave
override val requiredCapability: String = ChannelCapabilities.LEAVE_CHANNEL
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just one small question: I find it a bit strange that this was introduced in the refactor, but not actually used. Is it possible that we were missing some requiredCapabilities check? Or was its usage naturally removed as we were polishing the UI?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I'm not sure, maybe @aleksandar-apostolov remembers?

Copy link
Copy Markdown
Contributor Author

@gpunto gpunto Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I don't know the original intent, but the code checks the capabilities before instantiating an action (e.g. in buildGroupChannelActions), so having requiredCapability in the action itself seems redundant. Checking out the original commit that introduced it, it's unused there too, so probably it was an initial API design iteration

@gpunto gpunto force-pushed the rm-archive-primary branch from 8ed2de5 to f008b04 Compare April 7, 2026 07:41
@gpunto
Copy link
Copy Markdown
Contributor Author

gpunto commented Apr 7, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Around line 1201-1211: ChannelOptionItemVisibility's public API changed: its
constructor and copy(...) gained a seventh Boolean parameter isMuteUserVisible
(see <init>, copy and copy$default signatures), so add a migration note in
MIGRATION_TO_V7.md or CHANGELOG.md that describes the signature change (6 -> 7
params), lists the affected symbols (ChannelOptionItemVisibility constructor,
component1..component7, copy, copy$default), shows a before/after usage example,
and instructs consumers to add the new isMuteUserVisible Boolean (or use the
library's default behavior) when calling the constructor or copy to restore
previous behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a2e40ddd-d2a7-4f46-bdf4-4333f0be519d

📥 Commits

Reviewing files that changed from the base of the PR and between 2ad18d8 and f008b04.

📒 Files selected for processing (6)
  • stream-chat-android-compose/api/stream-chat-android-compose.api
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/DefaultChannelSwipeActions.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptionItemVisibility.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/viewmodel/channels/ChannelListViewModel.kt
  • stream-chat-android-compose/src/main/res/values/strings.xml
💤 Files with no reviewable changes (1)
  • stream-chat-android-compose/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/channels/list/DefaultChannelSwipeActions.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptions.kt

@gpunto gpunto force-pushed the rm-archive-primary branch from 1c56852 to 4dddc2d Compare April 7, 2026 08:29
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
8.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants